package com.ibeetl.admin.core.service;

import com.ibeetl.admin.core.entity.BaseEntity;
import com.ibeetl.admin.core.entity.RightRole;
import org.beetl.sql.core.SQLManager;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @ClassName CustomerRoleService
 * @Description: 会员权限
 * @author: tanbaocai
 * @date: 2019/12/6 9:34
 */
@Service
public class CustomerRoleService {
	private static final String SQL = "core.customerRight";
	@Resource
	private SQLManager sqlManager;

	/**
	 * 返回会员权限角色列表
	 * @return
	 */
	public List<RightRole> roleList() {
		return sqlManager.select(SQL+".roleList",RightRole.class);
	}

	public List<BaseEntity> roleList(String customerId) {
		Map<String,Object> param = new HashMap<>();
		param.put("customerId",customerId);
		return sqlManager.select(SQL+".customerRoleList",BaseEntity.class,param);
	}
}
